//大数加减
let a = '123456789123456789'
let b = '987654321987654321'


function sum(a,b){
    a= a.toString()
    b= b.toString()
    let len = Math.max(a.length,b.length)
    a.padStart(len,0)
    b.padStart(len,0)
    let res = ''
    let carry = 0
    
    for(let i=len-1;i>=0;i--){
        //a[i],b[i]
        let sum = +a[i]+ +b[i]+carry

        if(sum>=10){
             carry = Math.floor(sum/10)//进位
            let num = sum%10//当前位
            res = num + res
        }else{
            res = sum + res
        }

    }

    return res

}

